#include <bits/stdc++.h>
using namespace std;
int s[27], n, m;
void dfs(int place, int num) // place当前到哪一位了，num目前取了多少数了
{
	if (num == m)
	{
		for (int i = 1; i <= n; i++)
			if (s[i]) // 被标记
				cout << i << " ";
		cout << endl;
		return;
	}
	for (int i = place + 1; i <= n; i++)
	{
		s[i] = 1;
		dfs(i, num + 1);
		s[i] = 0;
	}
	return;
}
int main()
{
	cin >> n >> m;
	dfs(0, 0);
	return 0;
}